﻿$(function () {   
    $("#datepickerDeparture").datepicker(
    {
        minDate: 0,
        maxDate: "+1M",
        onSelect: function( selectedDate ) {
            $("#datepickerReturn").datepicker("option", "minDate", selectedDate);
        },
        altField: "#DepartureDate"
    });
    $("#datepickerReturn").datepicker(
    {
        minDate: 0,
        maxDate: "+1M",
        onSelect: function( selectedDate ) {
            $("#datepickerDeparture").datepicker("option", "maxDate", selectedDate);
        },
        altField: "#ReturnDate"
    });
});

$(function () {
    $(".help").popover();
});

$(function () {
    $("#submit_flight").click(function () {
        var form = $("#form_5");
        console.log(form.serialize());
        $.ajax({
            url : form.attr("action"),
            type: "POST",
            data: form.serialize(),
            success: function (data) {
                $('#Flight').html(data);
            },
            error: function (jqXhr, textStatus, errorThrown) {
                console.log("Error '" + jqXhr.status + "' (textStatus: '" + textStatus + "', errorThrown: '" + errorThrown + "')");
            }
        });
    });
});